package com.bzchao.niu.config;

import com.bzchao.netty.udp.consumer.StringUdpConsumer;
import com.bzchao.netty.udp.consumer.UdpConsumer;
import com.bzchao.niu.consumer.NiuMsgConsumer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.nio.charset.Charset;

@Configuration
public class NiuUdpConfig {
    /**
     * 配置udp消息的消费者
     * 对于实际的业务，只需要实现UdpConsumer或StringUdpConsumer即可
     */
    @Bean
    public UdpConsumer udpConsumer() {
        // 创建牛互贷的消息消费者
        StringUdpConsumer udpConsumer = new NiuMsgConsumer();
        udpConsumer.setRevCharset(Charset.forName("utf-8"));
        return udpConsumer;
    }

}
